﻿function SetVehicleType(obj) {
    var ddlVehicle = document.getElementById("GearingRec_VehicleId");
    var ddlVehicleType = document.getElementById("GearingRec_VehicleTypeId");

    vehicleTypeId = ddlVehicle.options[ddlVehicle.selectedIndex].value;

    ddlVehicleType.value = vehicleTypeId;
}

function UpdateVoltage() {
    var ddlCellType = document.getElementById("GearingRec_CellTypeId");
    var ddlCellCount = document.getElementById("GearingRec_CellCount");

    cellCount = ddlCellCount.options[ddlCellCount.selectedIndex].text;
    cellType = ddlCellType.options[ddlCellType.selectedIndex].text;

    var cellVoltage = 0;

    switch (cellType) {
        case "LiFe":
            cellVoltage = 3.3;
            break;
        case "LiPo":
            cellVoltage = 3.7;
            break;
        case "NiMh":
            cellVoltage = 1.2;
            break;
        case "NiCd":
            cellVoltage = 1.2;
            break;
    }

    voltage = cellVoltage * cellCount;

    voltage = Math.round(voltage*10)/10;

    document.getElementById("Voltage").innerText = voltage;

}

